
from appium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

desired_caps = {
    "platformName": "Android",
    "automationName": "uiautomator2",
    "platformVersion": "9",
    "deviceName": '192.168.2.184:5555',
    "appPackage": "com.seven.qaml.burstserven",
    "appActivity": "com.seven.qaml.burstserven.ui.PlanListActivity",
    'skipServerInstallation': False,
    'skipDeviceInitialization': False,
    "noReset": True
}
appium_server_url = 'http://127.0.0.1:4723'
driver = webdriver.Remote(appium_server_url, desired_caps)

sleep(3)

menu_id = "com.seven.qaml.burstserven:id/btn_delay_F1"

while True:
    WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID, menu_id))
    )
    driver.keyevent(132)
    driver.keyevent(20)
    driver.keyevent(66)
    sleep(1)
    driver.keyevent(4)





